package Day10.impl;

import Day10.Str;

/**
 * @Author kalista
 * @Description
 * @Date 2020/11/16  15:15
 **/
public class StrImpl implements Str {
    @Override
    public String reversal(String str) {
        if (str == null || "".equals(str) || str.isEmpty()){
            return "";
        }
        char start = str.charAt(0);
        char end = str.charAt(str.length()-1);
        String context = str.substring(1,str.length()-1);
        StringBuilder stringBuilder = new StringBuilder(context);
        return start+ stringBuilder.reverse().toString() + end;
    }
}
